{
  "properties" : { },
  "id" : "29201e4f2eaa4474aad7b93b393d6a25",
  "script" : null,
  "groupId" : "a7109e8f35c343dfa8220583ef254707",
  "name" : "添加",
  "createTime" : 1714063372116,
  "updateTime" : 1710949143790,
  "lock" : null,
  "createBy" : "管理员",
  "updateBy" : "管理员",
  "path" : "add",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ {
    "name" : "role",
    "value" : "root",
    "description" : "允许拥有该角色的访问",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "requestBody" : "{\r\n    \"compontPath\":\"\",\"icon\":\"layui-icon-component\",\"menuCode\":\"test1\",\"menuName\":\"test1\",\"path\":\"/test1\",\"sort\":99,\"status\":1,\"type\":\"1\"\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import com.gitee.fastmybatis.core.query.Query;

import 'com.wiwf.model.mapper.admin.dao.SysMenuMapper' as sysMenuMapper;

    if(body.menuId != null){
        
        if(body.type != 0){
            Query query = new Query().eq("parent_id",body.menuId);
            if(sysMenuMapper.getCount(query) > 0){
                exit 401, "包含子节点的目录不能变更类型！"
            }
        }

        return sysMenuMapper.update(body);
    }

return sysMenuMapper.save(body);